package com.coolingme.f01_simplefactory;

import com.coolingme.f01_simplefactory.factory.CourseFactory;

/**
 * 简单工厂测试类
 *
 * @author wangyue
 * @date 2020/9/16 14:45
 */
public class SimpleFactoryTest {

    public static void main(String[] args) {
        test1();
        test2();
        test3();
    }

    public static void test1() {
        ICourse javaCourse = CourseFactory.create1("java");
        ICourse pythonCourse = CourseFactory.create1("python");
        javaCourse.learn();
        pythonCourse.learn();
    }

    public static void test2() {
        ICourse javaCourse = CourseFactory.create2("com.coolingme.simplefactory.JavaCourse");
        ICourse pythonCourse = CourseFactory.create2("com.coolingme.simplefactory.PythonCourse");
        javaCourse.learn();
        pythonCourse.learn();
    }

    public static void test3() {
        ICourse javaCourse = CourseFactory.create3(JavaCourse.class);
        ICourse pythonCourse = CourseFactory.create3(PythonCourse.class);
        javaCourse.learn();
        pythonCourse.learn();
    }


}
